package cn.yili12.business.dto;

import lombok.Data;
import org.springframework.data.domain.Page;

import java.util.List;

@Data
public class PageInfo<T> {

    private List<T> list;
    private Integer pageNo;
    private Integer pageSize;
    private Integer totalPage;
    private Long totalElement;

    public PageInfo() {
    }

    public PageInfo(Page page) {
        this.list = page.getContent();
        this.pageNo = page.getNumber() + 1;
        this.pageSize = page.getSize();
        this.totalElement = page.getTotalElements();
        this.totalPage = page.getTotalPages();
    }
}
